<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Xuexi Hanzi</title>
</head>
	<body style='font-family: Georgia, "Times New Roman", "KaiTi", "楷体", STKaiti, "华文楷体", serif'>
	<table style="margin-left: auto; margin-right: auto; text-align: center"><tr><td><span style="font-size: 150%" id="question">年</span></td></tr>
		<tr><td><table width="100%"><tr><td style="background-color: green" onClick="correctClicked();">&nbsp;</td><td style="background-color: red" onClick="incorrectClicked();">&nbsp;</td></tr></table></td></tr>
	<tr><td><span id="answer1" onClick="toggleShowAnswer1();">?</span></td></tr>	
	<tr><td><span id="answer2" onClick="toggleShowAnswer2();">?</span></td></tr>	
	<tr><td><span id="answer3" onClick="toggleShowAnswer3();">?</span></td></tr>	
	</table>
<div style="display: none" id="questions">
#Characters from my character table at http://sites.google.com/site/xueshengluwen/
#Row 26
脑 nǎo 207 brain
行 xíng 147 okay
找 zhǎo 290 seek, return
听 tīng 375 hear
看 kàn 149 see
美 měi 192 beautiful
专业 zhuānyè 209+174 major, specialty
课 kè 218 lesson, class
#Row 27
聚会 jùhuì 228+229 party
电视 diànshì 206+438 TV
想 xiǎng 345 think, believe, suppose, wish, want, miss
#2013-10-07
年 nián 216 year
月 yuè 506 month
星期 xīngqī 219+220 week
玩儿 wánr 317+92 fun
出生 chūshēng 226 to be born
过 guò 430 celebrate
岁 suì 217 years of age
#2013-10-14
蛋糕 dàngāo 235+236 cake
送 sòng 288 give as gift
礼物 lǐwù 333+173 present
光盘 guāngpán 264+265 compact disc
唱歌 chànggē 328+329 sing
祝你生日快乐 zhùnǐshēngrìkuaìlè 230+245 I/we wish you a happy birthday
跳舞 tiàowǔ 330+331 dance
花儿 huār - flower
前 qián 493 the one before last
后 hòu 494 the one after next
#2013-10-21
点 diǎn 304 o'clock
分 fēn 287 minute
刻 kè 309 quarter
半 bàn 318 half
差 chà 308 to fall short of
早上 zǎoshang - early morning
中午 zhōngwǔ 222 noon
数学 shùxué 172 mathematics 
属 shǔ 227 to be born in the year of (one of the 12 animals)
#2013-11-04
睡觉 shuìjiào - sleep
洗澡 xízǎo - take shower
起床 qǐchuáng - get out of bed
以后 yǐhòu - after (X 以后 = after X)
以前 yǐqián - before (X 以前 = before X)
#2013-11-11
上班 shàngbān - go to work
下班 xiàbān - leave work
打扫 dǎsǎo - to clean, to sweep
从。。。到。。。 cóng...dào... 312 from ... to ...
开门 kāimén - open the door
关门 guānmén - close the door
银行 yínháng - bank
周末 zhōumò - weekend
#2013-11-18
散步 sànbù 380,381 take a walk
回家 huíjiā - return home
穿衣服 chuān_yīfu 351,352,340 put on clothes, get dressed
买东西 mǎi_dōngxi - to do the shopping
寿面 shòumiàn 251,252 birthday/longevity noodles
烤鸭 kǎoyā 249,250 roast duck
#2013-11-25
人民币 rénmínbì 39+503+504 renminbi
元 yuán 291 yuan
角 jiǎo 502 1/10 yuan
块 kuài 285 yuan (colloquial)
毛 máo 286 1/10 yuan (colloquial)
商场 shāngchǎng 266+267 market, bazaar
常常 chángcháng 268 often
</div>
<script>
questionsLines = document.getElementById("questions").textContent.split("\n")
questions = []
for (i in questionsLines) {
  var line = questionsLines[i].trim()
  if (line[0] != "#" && line != "") {
    questions.push(questionsLines[i])
  }
}
startRound()
pickQuestion()

	function startRound() {
		todo = questions.slice(0)
	}

	function pickQuestion() {
questionIndex = Math.floor(Math.random() * todo.length)
qanda = todo[questionIndex]
qanda_space = qanda.indexOf(" ")
q = qanda.substring(0, qanda_space)
a = qanda.substring(qanda_space + 1)
a_space1 = a.indexOf(" ")
a_space2 = a.indexOf(" ", a_space1 + 1)
a1 = a.substring(0, a_space1);
a2 = a.substring(a_space1 + 1, a_space2);
a3 = a.substring(a_space2 + 1);

document.getElementById("question").textContent = q
resetView()
updateView()
	}

function resetView() {
	showAnswer1 = showAnswer2 = showAnswer3 = false;
}
	
function updateView() {
	document.getElementById("answer1").textContent = showAnswer1 ? a1 : "?"
	document.getElementById("answer2").textContent = showAnswer2 ? a2 : "?"
	document.getElementById("answer3").textContent = showAnswer3 ? a3 : "?"
}

function toggleShowAnswer1() {
	showAnswer1 = !showAnswer1;
	updateView();
}

function toggleShowAnswer2() {
	showAnswer2 = !showAnswer2;
	updateView();
}

function toggleShowAnswer3() {
	showAnswer3 = !showAnswer3;
	updateView();
}

	function correctClicked() {
		todo.splice(questionIndex, 1);
		if (todo.length == 0) {
			window.alert("Round complete! Starting next round...")
			startRound()
		}
		pickQuestion()
	}
	
	function incorrectClicked() {
		pickQuestion()
	}

</script>
</body>
</html>